﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.IO;
using Gin.Commands;
using Gin;
using System.Globalization;
using Gin.Transactions;
using System.Data.SqlClient;
using Gin.Controls;


namespace GinBuilder
{
    public partial class MainForm : Form
    {
        MainFormController controller;

        public MainForm()
        {
            InitializeComponent();
            controller = new MainFormController();
            controller.Init(ArgumentsGroupBox);
        }

        private void CreatePackageButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            DialogResult dlgResult = dialog.ShowDialog();
            if (dlgResult == DialogResult.OK)
            {
                string packageFilePath = dialog.FileName;
                pathTextBox.Text = packageFilePath;
                controller.CreatePackage(packageFilePath);
            }

        }

        private void ExecutePackageButton_Click(object sender, EventArgs e)
        {
            string packageFilePath = pathTextBox.Text;
            controller.ExecutePackage(packageFilePath);
        }

        private void RollbackPackageButton_Click(object sender, EventArgs e)
        {
            string packageFilePath = pathTextBox.Text;
            controller.RollbackPackage(packageFilePath);
        }

    }
}
